<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>	
<%@ include file="/pub/headmeta.jsp" %>
</head>
<body class="edit-bgr-color">
	<div class="right-head"><span class="right-head-font">修改资讯文章&nbsp;-&nbsp;<%
	String classId=request.getParameter("classId");
	request.setAttribute("classId", classId);
	if("A000".equals(classId)){
		out.print("宝宝营养");
	}else if("B000".equals(classId)){
		out.print("宝宝扮靓");
	}else if("C000".equals(classId)){
		out.print("宝宝用品");
	}else if("D000".equals(classId)){
		out.print("宝宝娱乐");
	} %></span></div>
	<div align="center" style="width: 98%">	
		<form id="editForm" method="post" enctype="multipart/form-data">		
			<input type="hidden" name="msgId" id="msgId" value="${data.msgId}"/>
			<input type="hidden" name="classId" id="classId" value="${data.classId}"/>	
			<table cellpadding="5" style="width: 100%; font-size: 12px;">
				<tr>
					<td width="35%" align="right">标题：</td>
					<td width="65%"  align="left"><input type="text" name="msgTitle" id="msgTitle" style="width: 80%" value="${data.msgTitle}" />&nbsp;&nbsp;<font color='red'>*</font></td>					
				</tr>
				<tr>
					<td align="right">内容：</td>
					<td align="left"><textarea name="msgContent" id="msgContent"  rows="10" style="width: 80%">${data.msgContent}</textarea>&nbsp;&nbsp;<font color='red'>*</font></td>					
				</tr>
				<tr>
					<td align="right">配图(400*350)：</td>
					<td align="left"><input type="file" name="msgPic" id="msgPic" style="width: 80%" />&nbsp;&nbsp;<img height="40" width="40" src='${ctx}/sys!getPic.action?name=${data.msgPic}'/></td>					
				</tr>
			</table>
			<div class="edit-line"></div>
			<input  type="button" class="button-1" value="修改" onclick="doEdit();"/>
			<input  type="button" class="button-1" value="重置" onclick="resetEx(this.form);"/>						
			<input  type="button" class="button-1" value="返回" onclick="back();"/>
		</form>
	</div>
</body>
</html>
<script type="text/javascript">
<!--

//修改
function doEdit() {
	if ($("#msgTitle").val()== ""){
		alert('标题不能为空！');
		return;
	}
	if ($("#msgContent").val()== ""){
		alert('内容不能为空！');
		return;
	}
	$.uploadEx({        
		url: '${ctx}/msg!edit.action', 
		formId: "editForm",
		dataType: 'json',  
		onSend: function() {
	        return true;
	    },     
		onComplate: function(json) {        	
			if (json.code==0) {	
				back();	
			}else{
				alert('修改失败！');
			}
		}
	});
}
//返回
function back(){
	location.href="${ctx}/msg!viewList.action?classId=${classId}";
}
//-->
</script>
